package com.wutuo.wtservice.provider.dao;


import com.wutuo.wtservice.provider.domain.WtUserService;

import static org.apache.ibatis.jdbc.SqlBuilder.*;

/**
 * @author lvh
 * @version 1.0
 */
public class BaseUserServiceSqlProvider implements java.io.Serializable {
    public String insertSelective(WtUserService record) {
        BEGIN();
        INSERT_INTO("user_service");
        insertKey(record);
        return SQL();
    }

    public void insertKey(WtUserService record) {

        if (record.getWtServiceId() != null) {
            VALUES("wt_service_id", "#{wtServiceId,jdbcType=BIGINT}");
        }
        if (record.getRosterId() != null) {
            VALUES("roster_id", "#{rosterId,jdbcType=BIGINT}");
        }
        if (record.getCreateBy() != null) {
            VALUES("create_by", "#{createBy,jdbcType=BIGINT}");
        }
        if (record.getCreateDate() != null) {
            VALUES("create_date", "#{createDate,jdbcType=DATE}");
        }
        if (record.getUpdateBy() != null) {
            VALUES("update_by", "#{updateBy,jdbcType=BIGINT}");
        }
        if (record.getUpdateDate() != null) {
            VALUES("update_date", "#{updateDate,jdbcType=DATE}");
        }
        if (record.getRemarks() != null) {
            VALUES("remarks", "#{remarks,jdbcType=VARCHAR}");
        }
        if (record.getDelFlag() != null) {
            VALUES("del_flag", "#{delFlag,jdbcType=VARCHAR}");
        }
    }

    public String updateByPrimaryKeySelective(WtUserService record) {
        BEGIN();
        UPDATE("user_service");
        updateKey(record);
        WHERE("id = #{id,jdbcType=BIGINT}");
        return SQL();
    }

    public void updateKey(WtUserService record) {
        if (record.getId() != null) {
            SET("id = #{id,jdbcType=BIGINT}");
        }
        if (record.getWtServiceId() != null) {
            SET("wt_service_id = #{wtServiceId,jdbcType=BIGINT}");
        }
        if (record.getRosterId() != null) {
            SET("roster_id = #{rosterId,jdbcType=BIGINT}");
        }
        if (record.getCreateBy() != null) {
            SET("create_by = #{createBy,jdbcType=BIGINT}");
        }
        if (record.getCreateDate() != null) {
            SET("create_date = #{createDate,jdbcType=DATE}");
        }
        if (record.getUpdateBy() != null) {
            SET("update_by = #{updateBy,jdbcType=BIGINT}");
        }
        if (record.getUpdateDate() != null) {
            SET("update_date = #{updateDate,jdbcType=DATE}");
        }
        if (record.getRemarks() != null) {
            SET("remarks = #{remarks,jdbcType=VARCHAR}");
        }
        if (record.getDelFlag() != null) {
            SET("del_flag = #{delFlag,jdbcType=VARCHAR}");
        }
    }
}